#pragma once
#include "global.h"
#ifdef WIN32
	#include <WinSock2.h>
	#pragma comment(lib,"Ws2_32.lib")
	#define MSG_NOSIGNAL 0
	//WIN32
#else //Linux
	#include <sys/socket.h>
	#define INVALID_SOCKET  0
	#define SOCKET_ERROR    -1
#endif 


class SocketClient
{
public:
	SocketClient();
	~SocketClient();

	int Open(const char* szIp,WORD wPort);
	int Send(void* buf,DWORD dwDataLen);
	int Recv(void* pBuffer,DWORD dwLen,DWORD dwTimeout=6000);
	void Close();
	bool IsOpened();
	inline int SetLastError() ;
	int GetLastError() const;

private:
	int m_errno;
	int m_fd_connect;
};
